//
//  ZLScrollView.swift
//  ZLImageEditor
//
//  Created by 在成长开发 on 2025/10/30.
//

import UIKit

class ZLScrollView: UIScrollView {

    private var pinchDelegate = PinchProxy()

        override init(frame: CGRect) {
            super.init(frame: frame)
            guard let p = pinchGestureRecognizer else { return }
            p.delegate = pinchDelegate
        }

        required init?(coder: NSCoder) {
            super.init(coder: coder)
            guard let p = pinchGestureRecognizer else { return }
            p.delegate = pinchDelegate
        }

    
}

// 独立对象，避免循环引用
private final class PinchProxy: NSObject, UIGestureRecognizerDelegate {

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive event: UIEvent) -> Bool {
        if event.allTouches?.count == 1 {
            return false
        }
        return true
    }
}
